package com.geektime.hello;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author DRevelation
 * @Date 2020-07-21 下午 15:29
 * @Desc
 */
public class DateDemo {
    public static void main(String[] args) throws ParseException {
        // String a = sdf.("2020-07-21 15:50:00");
        // System.out.println(sdf.format(new Date()));
        // Date pushDate = new Date("2020-07-21T15:50:00Z");
        // System.out.println(sdf.format(pushDate));

        // String dateStr = "2020-07-23 10:22:00";
        // String a = String.valueOf(sdf.parse(dateStr).getTime());
        // Date pushDate = new DateFormat().parse(a);
        // System.out.println(pushDate);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = sdf.parse("2020-07-21T15:50:00Z");
        System.out.println(date);
        System.out.println(sdf2.format(date));
        System.out.println(new Date());

    }

    private static String change(String text) {
        return text.replace(" ", "T") + "Z";
    }
}
